<template>
  <div style="margin-top:20px">
    <el-form ref="form" label-width="80px" :model="form">
      <el-row>
        <el-col :span="24">
          <div class="grid-content bg-purple">
            <el-form-item label="合同编号" style="margin-right:15px">
              <el-input v-model="form.serialNum" :disabled="true"/>
            </el-form-item>
          </div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <div class="grid-content bg-purple">
            <el-form-item label="签订时间" style="margin-right:15px">
              <el-input v-model="form.signTime" :disabled="true"/>
            </el-form-item>
          </div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <div class="grid-content bg-purple">
            <el-form-item label="附件地址" style="margin-right:15px">
              <!--<el-input v-model="form.fileUrl" :disabled="true"/>-->
              <template v-for="(v,k) in fileList">
                <el-link target="_blank" type="primary" icon="el-icon-paperclip" :href="v.url">{{v.name}}</el-link>
                <br/>
              </template>
            </el-form-item>
          </div>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'

  export default {
    name: 'shipmentContractDetail',
    data() {
      return {
        fileList: [],
        emptyForm: {},
        form: {
          code: '',
          branchCode: '',
          partyCode: '',
          serialNum: '',
          signTime: '',
          fileUrl: ''
        }
      }
    },
    created() {
      //保存空表单对象
      this.emptyForm = JSON.parse(JSON.stringify(this.form))
    },
    methods: {
      // 获取页面信息
      getInfo(code) {
        //查询到数据之前先展示空表单
        this.form = JSON.parse(JSON.stringify(this.emptyForm))
        request({ url: `/ntocc-basic-api/shipmentContract/${code}`, method: 'get' }).then(response => {
          this.form = response.data;
          if (this.form.fileUrl) {
            this.fileList = JSON.parse(this.form.fileUrl);
          }
        })
      }
    }
  }
</script>
<style lang="scss" scoped>
  .dialog-footer {
    margin-top: 50px;
  }
</style>
